package JET.SA;

import JET.Constants;
import JET.Centers.ControlCenter;
import JET.Frames.DataModels.DataModelsFactory;
import JET.Scene;
import JET.StaticActions;
import JET.geom.Vec2d;
import JET.physics.engine.JETEngine;

/**
 *
 * @author raos
 */
public class SA_Menu implements Constants {

    static final ControlCenter CC = ControlCenter.getInstance();

    public synchronized static void clearScene(Scene scene) {
        SA_SpringBody.clearSpringBodies(scene, false);
        StaticActions.clearEngineSprings(scene, false);
        StaticActions.clearEngineRSprings(scene, false);
        StaticActions.clearActions();
        StaticActions.clearTorques(scene, false);
        scene.resetVirtualKeyboard();

        DataModelsFactory.getSceneTreeModel().fireWholeTreeChanged();
    }

    public synchronized static void zeroVelocities(Scene scene)
    {
        if (scene.EC.selectionGroup.isEmpty()) {
            JETEngine.zeroMass2dVelocities(scene.getJETContext());
        } else {
            SA_Selection.zeroSelectedMassVelocities(scene);
        }
        ControlCenter.getInstance().GUIC.updateView(CC.GUIC.getCurrentSceneName());
    }

    public synchronized static void randomVelocities(Scene scene)
    {
        if (scene.EC.selectionGroup.isEmpty()) {
            JETEngine.randomMass2dVelocities(scene.getJETContext());
        } else {
            SA_Selection.randomSelectedMassVelocities(scene);
        }
        CC.GUIC.updateView(CC.GUIC.getCurrentSceneName());
    }
    public synchronized static void setDrawMassForces(boolean draw, Scene scene, ControlCenter CC)
    {
        scene.GC.setDrawMass2dForces(draw);
        CC.GUIC.updateView(CC.GUIC.getCurrentSceneName());
    }

}
